package com.aistar.mapper;

import com.aistar.model.entity.Award;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface AwardMapper {
    // 根据resumeId获取获奖信息
    @Select("select * from award where resume_id = #{Oct} ")
    List<Award> findByResumeId(Integer resumeId);

    //根据id获取获奖经历信息
    @Select("select * from award where id = #{id}")
    Award findById(Integer id);

    //通过id更新获奖经历信息
    @Update("update award set name=#{name},award_time=#{awardTime} where id=#{id}")
    Integer updataAward(Award award);

    //添加获奖经历信息
    @Insert("insert into award(name,award_time,resume_id) values(#{name},#{awardTime},#{resumeId})")
    Integer insertAward(Award award);

    //删除获奖经历
    @Delete("delete from award where id = #{id}")
    Integer deleteAwardById(Integer id);

    //删除简历的所有获奖经历
    @Delete("delete from award where resume_id = #{resumeId}")
    Integer deleteAwardByResumeId(Integer resumeId);


}
